<h2 style="font-weight: bold; padding-bottom: 10px;">Hộp thư</h2>
<?php if (count($this->paginator) == 0) {?>
	<p align="center" style="font-size: 16px" class="text-info">Hộp thư rỗng</p>
<?php } else {
	if ($this->paginator != null) {
		if (!isset($_GET['page']))
			$count	= 0;
		else
			$count	= ($_GET['page'] - 1)*$this->perpage;
	}
?>
	<table class="table table-striped">
		<tr align="center" style="font-style: italic; font-size: 17px;">
			<td style="width: 5%"><strong>STT</strong></td>
			<td style="width: 20%"><strong>Người gửi</strong></td>
			<td style="width: 25%"><strong>Email</strong></td>
			<td style="width: 25%"><strong>Tiêu đề</strong></td>
			<td style="width: 20%"><strong>Thời gian</strong></td>
			<td style="width: 5%"></td>
		</tr>
	<?php
		foreach ($this->paginator as $item) : $count++;
			if ($item->visited == 0) {
				$url	=  $this->basePath()."/admin/detailcontact/".$item->contact_id;
	?>
			<tr align="center" style="font-weight: bold;">
				<td><?php echo $count; ?></td>
				<td><a style="color: black; text-decoration: none;" href="<?php echo $url; ?>"><?php echo $item->name; ?></a></td>
				<td><a style="color: black; text-decoration: none;" href="<?php echo $url; ?>"><?php echo $item->email; ?></a></td>
				<td><a style="color: black; text-decoration: none;" href="<?php echo $url; ?>"><?php echo $item->title; ?></a></td>
				<td><a style="color: black; text-decoration: none;" href="<?php echo $url; ?>"><?php echo $item->created_at; ?></a></td>
				<td><a href="<?php echo $this->basePath()?>/admin/deletecontact/<?php echo $item->contact_id; ?>" Onclick="return ConfirmDelete()">
						<i class="glyphicon glyphicon-trash"></i>
					</a></td>
			</tr>
	<?php
			}
			else {
				$url	=  $this->basePath()."/admin/detailcontact/".$item->contact_id;
	?>
			<tr align="center">
				<td><?php echo $count; ?></td>
				<td><a style="color: black; text-decoration: none;" href="<?php echo $url; ?>"><?php echo $item->name; ?></a></td>
				<td><a style="color: black; text-decoration: none;" href="<?php echo $url; ?>"><?php echo $item->email; ?></a></td>
				<td><a style="color: black; text-decoration: none;" href="<?php echo $url; ?>"><?php echo $item->title; ?></a></td>
				<td><a style="color: black; text-decoration: none;" href="<?php echo $url; ?>"><?php echo $item->created_at; ?></a></td>
				<td><a href="<?php echo $this->basePath()?>/admin/deletecontact/<?php echo $item->contact_id; ?>" Onclick="return ConfirmDelete()">
						<i class="glyphicon glyphicon-trash"></i>
					</a></td>
			</tr>
	<?php
			}
		endforeach;
	?>
	</table>
<?php
	}

	$url	= "viewcontact";
	echo $this->paginationControl(
			$this->paginator,
			'sliding',
			array('partial/admin/paginator.phtml', 'Contact'),
			array(
					'route' => 'admin',
					'url'	=> $url,
			)
	);
